<?php
/**
 * Created by PhpStorm.
 * User: 李迪
 * Date: 2019/2/23
 * Time: 10:05
 */
namespace App\Services\Homepage;

use App\Model\Search;
use App\Services\CommonService;
use Illuminate\Support\Facades\DB;

class SearchService extends CommonService
{

    //获取搜索历史
    public function getList()
    {
        $arr = DB::table('search')
            ->orderByRaw('id desc')
            ->limit(5)
            ->get()
            ->toArray();
        return $arr;
    }

    //获取搜索次数最多的五条记录
    public function getMax()
    {
        $arr = DB::table('search')
            ->orderByRaw('times desc')
            ->limit(5)
            ->get()
            ->toArray();
        return $arr;
    }
}